package cn.juque.datapipeline.api.enums;

/**
 * @author nuoka
 * @version 1.0.0
 * <li></li>
 * @date 2022/7/21 14:35
 **/
public enum DataOpTypeEnum {

    /**
     * enum
     */
    INSERT(1, "insert"),
    INSERT_OR_UPDATE(2, "insertOrUpdate"),
    UPDATE(3, "update"),
    DELETE(4, "delete");

    private final Integer value;

    private final String label;

    DataOpTypeEnum(Integer value, String label) {
        this.value = value;
        this.label = label;
    }

    public Integer getValue() {
        return value;
    }

    public static DataOpTypeEnum forEnum(Integer value) {
        for (DataOpTypeEnum dataOpTypeEnum : DataOpTypeEnum.values()) {
            if (dataOpTypeEnum.getValue().equals(value)) {
                return dataOpTypeEnum;
            }
        }
        return INSERT;
    }
}
